WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::TimeStamp Class Reference

TimeStamp implements basic functionalities for time stamps. More...

#include <core/common/time_stamp.h>

Public Member Functions

 TimeStamp ()
 Default constructor: zero and not valid time stamp. More...
 
 TimeStamp (const TimeStamp &_ts)
 Copy constructor. More...
 
 TimeStamp (const double &_ts)
 Constructor from seconds (not valid if negative) More...
 
 TimeStamp (const unsigned long int &_sec, const unsigned long int &_nsec)
 Constructor from sec and nsec. More...
 
 ~TimeStamp ()
 Destructor. More...
 
bool ok () const
 Returns whether the time stamp has a valid value. More...
 
void setOk ()
 Sets the time stamp as valid. More...
 
void setNOk ()
 Sets the time stamp as not valid. More...
 
void setToNow ()
 Sets the time stamp to now (valid) More...
 
void set (const timeval &ts)
 Set time stamp. More...
 
void set (const unsigned long int &sec, const unsigned long int &nanosec)
 Set time stamp. More...
 
void set (const double &ts)
 Set time stamp. More...
 
double get () const
 Get time stamp. More...
 
unsigned long int getSeconds () const
 Get time stamp (only seconds) More...
 
unsigned long int getNanoSeconds () const
 Get time stamp (only nano seconds) More...
 
void operator= (const double &ts)
 Assignment operator given a scalar_t (seconds), not valid if negative. More...
 
void operator= (const TimeStamp &ts)
 Assignment operator. More...
 
bool operator!= (const TimeStamp &ts) const
 Inequality operator. More...
 
bool operator== (const TimeStamp &ts) const
 Equality operator. More...
 
bool operator< (const TimeStamp &ts) const
 Less than operator. More...
 
bool operator> (const TimeStamp &ts) const
 Greater than operator. More...
 
bool operator<= (const TimeStamp &ts) const
 Less or equal than operator. More...
 
bool operator>= (const TimeStamp &ts) const
 Greater or equal than operator. More...
 
void operator+= (const double &dt)
 Add-assign operator given a scalar_t (seconds) More...
 
TimeStamp operator+ (const double &dt) const
 Addition operator given a scalar_t (seconds) More...
 
void operator-= (const double &dt)
 Subtraction-assign operator given a scalar_t (seconds). Not valid if the result would be negative. More...
 
TimeStamp operator- (const double &ts) const
 Subtraction operator given a scalar_t (seconds), returning a TimeStamp. More...
 
double operator- (const TimeStamp &ts) const
 Difference operator, returning a scalar_t (seconds) More...
 
void print (std::ostream &ost=std::cout) const
 Prints time stamp to a given ostream. More...
 
std::string string () const
 Returns a string with the Timestamp. More...
 

Static Public Member Functions

static TimeStamp Invalid ()
 Returns a not valid time stamp. More...
 
static TimeStamp Now ()
 Returns a time stamp set to now. More...
 

Protected Attributes

unsigned long int time_stamp_nano_
 Time stamp. Expressed in nanoseconds since 1st Jan 1970. More...
 
bool is_valid_
 Whether the time stamp has a valid value. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const TimeStamp &_ts)
 Prints the time stamp to a stream. More...
 

Detailed Description

TimeStamp implements basic functionalities for time stamps.

TimeStamp implements basic functionalities for time stamps

Constructor & Destructor Documentation

◆ TimeStamp() [1/4]

wolf::TimeStamp::TimeStamp ( )

Default constructor: zero and not valid time stamp.

◆ TimeStamp() [2/4]

wolf::TimeStamp::TimeStamp ( const TimeStamp &  _ts)

Copy constructor.

Copy constructor

◆ TimeStamp() [3/4]

wolf::TimeStamp::TimeStamp ( const double &  _ts)

Constructor from seconds (not valid if negative)

◆ TimeStamp() [4/4]

wolf::TimeStamp::TimeStamp ( const unsigned long int &  _sec,
const unsigned long int &  _nsec 
)

Constructor from sec and nsec.

Constructor from sec and nsec

◆ ~TimeStamp()

wolf::TimeStamp::~TimeStamp ( )

Destructor.

Destructor

Member Function Documentation

◆ get()

double wolf::TimeStamp::get ( ) const
inline

Get time stamp.

Returns time stamp

◆ getNanoSeconds()

unsigned long int wolf::TimeStamp::getNanoSeconds ( ) const
inline

Get time stamp (only nano seconds)

Returns nanoseconds part of time stamp

◆ getSeconds()

unsigned long int wolf::TimeStamp::getSeconds ( ) const
inline

Get time stamp (only seconds)

Returns seconds of time stamp

◆ Invalid()

wolf::TimeStamp wolf::TimeStamp::Invalid ( )
inlinestatic

Returns a not valid time stamp.

◆ Now()

TimeStamp wolf::TimeStamp::Now ( )
static

Returns a time stamp set to now.

◆ ok()

bool wolf::TimeStamp::ok ( ) const
inline

Returns whether the time stamp has a valid value.

◆ operator!=()

bool wolf::TimeStamp::operator!= ( const TimeStamp &  ts) const
inline

Inequality operator.

◆ operator+()

TimeStamp wolf::TimeStamp::operator+ ( const double &  dt) const

Addition operator given a scalar_t (seconds)

◆ operator+=()

void wolf::TimeStamp::operator+= ( const double &  dt)
inline

Add-assign operator given a scalar_t (seconds)

◆ operator-() [1/2]

TimeStamp wolf::TimeStamp::operator- ( const double &  ts) const

Subtraction operator given a scalar_t (seconds), returning a TimeStamp.

◆ operator-() [2/2]

double wolf::TimeStamp::operator- ( const TimeStamp &  ts) const
inline

Difference operator, returning a scalar_t (seconds)

◆ operator-=()

void wolf::TimeStamp::operator-= ( const double &  dt)

Subtraction-assign operator given a scalar_t (seconds). Not valid if the result would be negative.

◆ operator<()

bool wolf::TimeStamp::operator< ( const TimeStamp &  ts) const
inline

Less than operator.

◆ operator<=()

bool wolf::TimeStamp::operator<= ( const TimeStamp &  ts) const
inline

Less or equal than operator.

◆ operator=() [1/2]

void wolf::TimeStamp::operator= ( const double &  ts)
inline

Assignment operator given a scalar_t (seconds), not valid if negative.

◆ operator=() [2/2]

void wolf::TimeStamp::operator= ( const TimeStamp &  ts)
inline

Assignment operator.

◆ operator==()

bool wolf::TimeStamp::operator== ( const TimeStamp &  ts) const
inline

Equality operator.

◆ operator>()

bool wolf::TimeStamp::operator> ( const TimeStamp &  ts) const
inline

Greater than operator.

◆ operator>=()

bool wolf::TimeStamp::operator>= ( const TimeStamp &  ts) const
inline

Greater or equal than operator.

◆ print()

void wolf::TimeStamp::print ( std::ostream &  ost = std::cout) const

Prints time stamp to a given ostream.

Prints time stamp to a given ostream

◆ set() [1/3]

void wolf::TimeStamp::set ( const double &  ts)
inline

Set time stamp.

Sets time stamp to a given value passed as a scalar_t (seconds)

◆ set() [2/3]

void wolf::TimeStamp::set ( const timeval &  ts)
inline

Set time stamp.

Sets time stamp to a given value passed as a timeval struct

◆ set() [3/3]

void wolf::TimeStamp::set ( const unsigned long int &  sec,
const unsigned long int &  nanosec 
)
inline

Set time stamp.

Sets time stamp to a given value passed as a two-integer (seconds and nanoseconds)

◆ setNOk()

void wolf::TimeStamp::setNOk ( )
inline

Sets the time stamp as not valid.

◆ setOk()

void wolf::TimeStamp::setOk ( )
inline

Sets the time stamp as valid.

◆ setToNow()

void wolf::TimeStamp::setToNow ( )

Sets the time stamp to now (valid)

◆ string()

std::string wolf::TimeStamp::string ( ) const
inline

Returns a string with the Timestamp.

To be used by the logger

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const TimeStamp &  _ts 
)
friend

Prints the time stamp to a stream.

Member Data Documentation

◆ is_valid_

bool wolf::TimeStamp::is_valid_
protected

Whether the time stamp has a valid value.

◆ time_stamp_nano_

unsigned long int wolf::TimeStamp::time_stamp_nano_
protected

Time stamp. Expressed in nanoseconds since 1st Jan 1970.


The documentation for this class was generated from the following files: